package com.webserver.core;

import java.io.IOException;
import java.io.InputStream;
import java.net.ServerSocket;
import java.net.Socket;

public class WebServerApplication {
    private ServerSocket serverSocket;
    public WebServerApplication(){
        try {
            serverSocket= new ServerSocket(8088);
        } catch (IOException e) {
            e.printStackTrace();
        }
    }

    public void start(){
        try {
           while (true) {
                Socket socket = serverSocket.accept();
                Runnable r= new ClientHandler(socket);
               Thread thread =Thread.currentThread();
               System.out.println("111111当前线程为："+thread+"111111111111111111111111111");
                Thread t = new Thread(r);
                t.start();
         }


        } catch (IOException e) {
            e.printStackTrace();
        }

    }

    public static void main(String[] args) {
        WebServerApplication webServerApplication = new WebServerApplication();
        webServerApplication.start();
    }
}
